# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Dataproc.V1.Model.TaskData do
  @moduledoc """
  Data corresponding to tasks created by spark.

  ## Attributes

  *   `accumulatorUpdates` (*type:* `list(GoogleApi.Dataproc.V1.Model.AccumulableInfo.t)`, *default:* `nil`) - 
  *   `attempt` (*type:* `integer()`, *default:* `nil`) - 
  *   `durationMillis` (*type:* `String.t`, *default:* `nil`) - 
  *   `errorMessage` (*type:* `String.t`, *default:* `nil`) - 
  *   `executorId` (*type:* `String.t`, *default:* `nil`) - 
  *   `executorLogs` (*type:* `map()`, *default:* `nil`) - 
  *   `gettingResultTimeMillis` (*type:* `String.t`, *default:* `nil`) - 
  *   `hasMetrics` (*type:* `boolean()`, *default:* `nil`) - 
  *   `host` (*type:* `String.t`, *default:* `nil`) - 
  *   `index` (*type:* `integer()`, *default:* `nil`) - 
  *   `launchTime` (*type:* `DateTime.t`, *default:* `nil`) - 
  *   `partitionId` (*type:* `integer()`, *default:* `nil`) - 
  *   `resultFetchStart` (*type:* `DateTime.t`, *default:* `nil`) - 
  *   `schedulerDelayMillis` (*type:* `String.t`, *default:* `nil`) - 
  *   `speculative` (*type:* `boolean()`, *default:* `nil`) - 
  *   `stageAttemptId` (*type:* `integer()`, *default:* `nil`) - 
  *   `stageId` (*type:* `String.t`, *default:* `nil`) - 
  *   `status` (*type:* `String.t`, *default:* `nil`) - 
  *   `taskId` (*type:* `String.t`, *default:* `nil`) - 
  *   `taskLocality` (*type:* `String.t`, *default:* `nil`) - 
  *   `taskMetrics` (*type:* `GoogleApi.Dataproc.V1.Model.TaskMetrics.t`, *default:* `nil`) - 
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :accumulatorUpdates => list(GoogleApi.Dataproc.V1.Model.AccumulableInfo.t()) | nil,
          :attempt => integer() | nil,
          :durationMillis => String.t() | nil,
          :errorMessage => String.t() | nil,
          :executorId => String.t() | nil,
          :executorLogs => map() | nil,
          :gettingResultTimeMillis => String.t() | nil,
          :hasMetrics => boolean() | nil,
          :host => String.t() | nil,
          :index => integer() | nil,
          :launchTime => DateTime.t() | nil,
          :partitionId => integer() | nil,
          :resultFetchStart => DateTime.t() | nil,
          :schedulerDelayMillis => String.t() | nil,
          :speculative => boolean() | nil,
          :stageAttemptId => integer() | nil,
          :stageId => String.t() | nil,
          :status => String.t() | nil,
          :taskId => String.t() | nil,
          :taskLocality => String.t() | nil,
          :taskMetrics => GoogleApi.Dataproc.V1.Model.TaskMetrics.t() | nil
        }

  field(:accumulatorUpdates, as: GoogleApi.Dataproc.V1.Model.AccumulableInfo, type: :list)
  field(:attempt)
  field(:durationMillis)
  field(:errorMessage)
  field(:executorId)
  field(:executorLogs, type: :map)
  field(:gettingResultTimeMillis)
  field(:hasMetrics)
  field(:host)
  field(:index)
  field(:launchTime, as: DateTime)
  field(:partitionId)
  field(:resultFetchStart, as: DateTime)
  field(:schedulerDelayMillis)
  field(:speculative)
  field(:stageAttemptId)
  field(:stageId)
  field(:status)
  field(:taskId)
  field(:taskLocality)
  field(:taskMetrics, as: GoogleApi.Dataproc.V1.Model.TaskMetrics)
end

defimpl Poison.Decoder, for: GoogleApi.Dataproc.V1.Model.TaskData do
  def decode(value, options) do
    GoogleApi.Dataproc.V1.Model.TaskData.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Dataproc.V1.Model.TaskData do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
